Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokyo12: proxy_set_header Host $http_host #112

Merged
merged 1 commit into from
Aug 3, 2024

Conversation

osyoyu
Copy link
Contributor

@osyoyu osyoyu commented Aug 3, 2024

Follow-up of #110.

https://regional.rubykaigi.org/tokyo12/ が 200 になる一方、 https://regional.rubykaigi.org/tokyo12 (trailing slash なし) が https://osyoyu.github.io/tokyo12/ への 302 になってしまうのを解消したいパッチです。 osyoyu.github.io はなるべく露出させたくない。

  • trailing slash がない場合、trailing slash ありのパスに 302 するのは GitHub Pages の仕様
  • そのときの Location が osyoyu.github.io になる(GitHub Pages は regional.rubykaigi.org からプロキシされていることを当然知らないから)

そこで……

  • GitHub Pages の custom domainregional.rubykaigi.org を設定した
    • CNAME ファイルを置くやつ
    • なお verification は(当然)通していない
  • すると GitHub Pages は regional.rubykaigi.org でホストされている前提の挙動になる
    • trailing slash なしのアクセス時の 302 の Location も regional.rubykaigi.org になる
    • (おまけ: baseUrl が /tokyo12 から / になる)

ということなのですが、アクセス時に期待される Host ヘッダも regional.rubykaigi.org になるわけです。そこで proxy_set_header を指定する必要がある、という内容のパッチでした。

location ~ ^/tokyo12(.*) {
location /tokyo12 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ついでに無駄に (?) regex だったのをやめた

@osyoyu
Copy link
Contributor Author

osyoyu commented Aug 3, 2024

@sorah r?

@sorah sorah merged commit 65366c0 into ruby-no-kai:master Aug 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants